package com.lzm.ydpt.module.order.activity;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.byt.framlib.base.BaseActivity;
import com.byt.framlib.basemvp.BasePresenter;
import com.byt.framlib.commonwidget.LoadingTip;
import com.byt.framlib.commonwidget.NormalTitleBar;
import com.byt.framlib.commonwidget.OnNoDoubleClickListener;
import com.byt.framlib.commonwidget.onclicktwo.AntiShake;
import com.byt.framlib.commonwidget.selectordialog.dialog.DialogOnClickListener;
import com.byt.framlib.commonwidget.selectordialog.dialog.NormalAlertDialog;
import com.lzm.ydpt.R;
import com.lzm.ydpt.module.order.dialog.CancelCauseDialog;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 支付结果页
 */
public class PayResultsActivity extends BaseActivity {

    @BindView(R.id.ntb_pay_results)
    NormalTitleBar ntb_pay_results;
    @BindView(R.id.ltip_pay_results)
    LoadingTip ltip_pay_results;

    @BindView(R.id.tv_order_mail_info)
    TextView tv_order_mail_info;
    @BindView(R.id.tv_order_mail_address)
    TextView tv_order_mail_address;

    @BindView(R.id.tv_order_delivery_info)
    TextView tv_order_delivery_info;
    @BindView(R.id.tv_order_delivery_address)
    TextView tv_order_delivery_address;

    @BindView(R.id.tv_order_detail_goods)
    TextView tv_order_detail_goods;
    @BindView(R.id.tv_order_detail_qu_time)
    TextView tv_order_detail_qu_time;
    @BindView(R.id.tv_order_detail_remark)
    TextView tv_order_detail_remark;
    @BindView(R.id.img_sign_order_detail)
    ImageView img_sign_order_detail;

    @BindView(R.id.tv_order_distance)
    TextView tv_order_distance;
    @BindView(R.id.tv_order_amount)
    TextView tv_order_amount;
    @BindView(R.id.tv_price_increase)
    TextView tv_price_increase;

    @BindView(R.id.tv_order_number)
    TextView tv_order_number;
    @BindView(R.id.tv_order_time)
    TextView tv_order_time;
    @BindView(R.id.tv_order_rmb_amount)
    TextView tv_order_rmb_amount;
    @BindView(R.id.tv_order_state)
    TextView tv_order_state;

    @Override
    public int getLayoutId() {
        return R.layout.activity_pay_results;
    }

    @Override
    public BasePresenter initPreData() {
        return null;
    }

    @Override
    public void initView() {
        ntb_pay_results.setTitleText(mBContext.getResources().getString(R.string.app_name));
        ntb_pay_results.setOnBackListener(new OnNoDoubleClickListener() {
            @Override
            protected void onNoDoubleClick(View v) {
                finish();
            }
        });
    }

    @OnClick({R.id.tv_cancel_order, R.id.tv_next_order})
    public void OnClick(View v) {
        if (AntiShake.check(v.getId())) {
            return;
        }
        switch (v.getId()) {
            case R.id.tv_cancel_order:
                NormalAlertDialog normalAlertDialog = new NormalAlertDialog.Builder(mBContext)
                        .setButtonTextSize(14)
                        .setTitleVisible(true)
                        .setTitleText("取消订单")
                        .setTitleTextSize(16)
                        .setTitleTextColor(R.color.color_333333)
                        .setContentText("当前骑手资源充足，要不再等等？")
                        .setContentTextSize(14)
                        .setContentTextColor(R.color.color_666666)
                        .setRightButtonText("再等等")
                        .setRightButtonTextColor(R.color.color_main)
                        .setRightButtonText("取消订单")
                        .setRightButtonTextColor(R.color.color_bbbbbb)
                        .setOnclickListener(new DialogOnClickListener() {

                            @Override
                            public void clickLeftButton(View view) {
                                CancelCauseDialog dialog = new CancelCauseDialog.Builder(PayResultsActivity.this)
                                        .setType(1)
                                        .setOnListener(new CancelCauseDialog.OnCancelCauseListener() {
                                            @Override
                                            public void onSubmit() {

                                            }

                                            @Override
                                            public void onClose() {

                                            }
                                        }).build();
                                dialog.show();
                            }

                            @Override
                            public void clickRightButton(View view) {

                            }
                        })
                        .build();
                normalAlertDialog.show();
                break;
            case R.id.tv_next_order:
                openActivity(UserMainActivity.class);
                break;
        }
    }
}